import 'package:ls_work/a_elder/models/code_value_entity.dart';
import 'package:ls_work/model/food_sample/food_sample_submit_data.dart';

/// branchId : 6627
/// createdBy : "5"
/// createdDate : "2022-10-10 21:24:43"
/// customerId : 5
/// customerName : "超级管理员"
/// deleteStatus : 0
/// destroyedDate : "2022-10-10 21:24:00"
/// details : [{"attachList":[{"attachId":4905,"detailId":7}],"branchId":6627,"category":"2","createdBy":"5","createdDate":"2022-10-10 21:24:43","deleteStatus":0,"foodName":"土豆","foodSampleId":5,"id":7,"label":"11","saasId":1000,"sampleVolume":"10.000","tenantId":1000,"updatedBy":"5","updatedDate":"2022-10-10 21:24:43"},{"attachList":null,"branchId":6627,"category":"1","createdBy":"5","createdDate":"2022-10-10 21:24:43","deleteStatus":0,"foodName":"番茄","foodSampleId":5,"id":8,"label":"12","saasId":1000,"sampleVolume":"10.000","tenantId":1000,"updatedBy":"5","updatedDate":"2022-10-10 21:24:43"}]
/// id : 5
/// saasId : 1000
/// sampleDate : "2022-10-10 21:23:00"
/// sampleNo : "a103"
/// sampleNum : null
/// sterDate : "2022-10-10 21:23:00"
/// tenantId : 1000
/// updatedBy : "5"
/// updatedDate : "2022-10-10 21:24:43"

class FoodSampleDetailResponse {
  FoodSampleDetailResponse({
    this.branchId,
    this.createdBy,
    this.createdDate,
    this.customerId,
    this.customerName,
    this.deleteStatus,
    this.destroyedDate,
    this.details,
    this.id,
    this.saasId,
    this.sampleDate,
    this.sampleNo,
    this.sampleNum,
    this.sterDate,
    this.tenantId,
    this.updatedBy,
    this.updatedDate,});

  FoodSampleDetailResponse.fromJson(dynamic json) {
    branchId = json['branchId'];
    createdBy = json['createdBy'];
    createdDate = json['createdDate'];
    customerId = json['customerId'];
    customerName = json['customerName'];
    deleteStatus = json['deleteStatus'];
    destroyedDate = json['destroyedDate'];
    if (json['details'] != null) {
      details = [];
      json['details'].forEach((v) {
        details?.add(Details.fromJson(v));
      });
    }
    id = json['id'];
    saasId = json['saasId'];
    sampleDate = json['sampleDate'];
    sampleNo = json['sampleNo'];
    sampleNum = json['sampleNum'];
    sterDate = json['sterDate'];
    tenantId = json['tenantId'];
    updatedBy = json['updatedBy'];
    updatedDate = json['updatedDate'];
  }

  num? branchId;
  String? createdBy;
  String? createdDate;
  num? customerId;
  String? customerName;
  num? deleteStatus;
  String? destroyedDate;
  List<Details>? details;
  num? id;
  num? saasId;
  String? sampleDate;
  String? sampleNo;
  dynamic sampleNum;
  String? sterDate;
  num? tenantId;
  String? updatedBy;
  String? updatedDate;

  FoodSampleDetailResponse copyWith({ num? branchId,
    String? createdBy,
    String? createdDate,
    num? customerId,
    String? customerName,
    num? deleteStatus,
    String? destroyedDate,
    List<Details>? details,
    num? id,
    num? saasId,
    String? sampleDate,
    String? sampleNo,
    dynamic sampleNum,
    String? sterDate,
    num? tenantId,
    String? updatedBy,
    String? updatedDate,
  }) =>
      FoodSampleDetailResponse(branchId: branchId ?? this.branchId,
        createdBy: createdBy ?? this.createdBy,
        createdDate: createdDate ?? this.createdDate,
        customerId: customerId ?? this.customerId,
        customerName: customerName ?? this.customerName,
        deleteStatus: deleteStatus ?? this.deleteStatus,
        destroyedDate: destroyedDate ?? this.destroyedDate,
        details: details ?? this.details,
        id: id ?? this.id,
        saasId: saasId ?? this.saasId,
        sampleDate: sampleDate ?? this.sampleDate,
        sampleNo: sampleNo ?? this.sampleNo,
        sampleNum: sampleNum ?? this.sampleNum,
        sterDate: sterDate ?? this.sterDate,
        tenantId: tenantId ?? this.tenantId,
        updatedBy: updatedBy ?? this.updatedBy,
        updatedDate: updatedDate ?? this.updatedDate,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['branchId'] = branchId;
    map['createdBy'] = createdBy;
    map['createdDate'] = createdDate;
    map['customerId'] = customerId;
    map['customerName'] = customerName;
    map['deleteStatus'] = deleteStatus;
    map['destroyedDate'] = destroyedDate;
    if (details != null) {
      map['details'] = details?.map((v) => v.toJson()).toList();
    }
    map['id'] = id;
    map['saasId'] = saasId;
    map['sampleDate'] = sampleDate;
    map['sampleNo'] = sampleNo;
    map['sampleNum'] = sampleNum;
    map['sterDate'] = sterDate;
    map['tenantId'] = tenantId;
    map['updatedBy'] = updatedBy;
    map['updatedDate'] = updatedDate;
    return map;
  }


}



/// attachList : [{"attachId":4905,"detailId":7}]
/// branchId : 6627
/// category : "2"
/// createdBy : "5"
/// createdDate : "2022-10-10 21:24:43"
/// deleteStatus : 0
/// foodName : "土豆"
/// foodSampleId : 5
/// id : 7
/// label : "11"
/// saasId : 1000
/// sampleVolume : "10.000"
/// tenantId : 1000
/// updatedBy : "5"
/// updatedDate : "2022-10-10 21:24:43"

class Details {
  Details({
    this.attachList,
    this.branchId,
    this.category,
    this.createdBy,
    this.createdDate,
    this.deleteStatus,
    this.foodName,
    this.foodSampleId,
    this.id,
    this.label,
    this.saasId,
    this.sampleVolume,
    this.tenantId,
    this.updatedBy,
    this.updatedDate,});

  Details.fromJson(dynamic json) {
    if (json['attachList'] != null) {
      attachList = [];
      json['attachList'].forEach((v) {
        attachList?.add(AttachList.fromJson(v));
      });
    }
    branchId = json['branchId'];
    category = json['category'];
    createdBy = json['createdBy'];
    createdDate = json['createdDate'];
    deleteStatus = json['deleteStatus'];
    foodName = json['foodName'];
    foodSampleId = json['foodSampleId'];
    id = json['id'];
    label = json['label'];
    saasId = json['saasId'];
    sampleVolume = json['sampleVolume'];
    tenantId = json['tenantId'];
    updatedBy = json['updatedBy'];
    updatedDate = json['updatedDate'];
  }

  List<AttachList>? attachList;
  num? branchId;
  String? category;
  String? createdBy;
  String? createdDate;
  num? deleteStatus;
  String? foodName;
  num? foodSampleId;
  num? id;
  String? label;
  num? saasId;
  String? sampleVolume;
  num? tenantId;
  String? updatedBy;
  String? updatedDate;

  Details copyWith({ List<AttachList>? attachList,
    num? branchId,
    String? category,
    String? createdBy,
    String? createdDate,
    num? deleteStatus,
    String? foodName,
    num? foodSampleId,
    num? id,
    String? label,
    num? saasId,
    String? sampleVolume,
    num? tenantId,
    String? updatedBy,
    String? updatedDate,
  }) =>
      Details(attachList: attachList ?? this.attachList,
        branchId: branchId ?? this.branchId,
        category: category ?? this.category,
        createdBy: createdBy ?? this.createdBy,
        createdDate: createdDate ?? this.createdDate,
        deleteStatus: deleteStatus ?? this.deleteStatus,
        foodName: foodName ?? this.foodName,
        foodSampleId: foodSampleId ?? this.foodSampleId,
        id: id ?? this.id,
        label: label ?? this.label,
        saasId: saasId ?? this.saasId,
        sampleVolume: sampleVolume ?? this.sampleVolume,
        tenantId: tenantId ?? this.tenantId,
        updatedBy: updatedBy ?? this.updatedBy,
        updatedDate: updatedDate ?? this.updatedDate,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (attachList != null) {
      map['attachList'] = attachList?.map((v) => v.toJson()).toList();
    }
    map['branchId'] = branchId;
    map['category'] = category;
    map['createdBy'] = createdBy;
    map['createdDate'] = createdDate;
    map['deleteStatus'] = deleteStatus;
    map['foodName'] = foodName;
    map['foodSampleId'] = foodSampleId;
    map['id'] = id;
    map['label'] = label;
    map['saasId'] = saasId;
    map['sampleVolume'] = sampleVolume;
    map['tenantId'] = tenantId;
    map['updatedBy'] = updatedBy;
    map['updatedDate'] = updatedDate;
    return map;
  }

}

/// attachId : 4905
/// detailId : 7

class AttachList {
  AttachList({
    this.attachId,
    this.detailId,});

  AttachList.fromJson(dynamic json) {
    attachId = json['attachId'];
    detailId = json['detailId'];
  }

  num? attachId;
  num? detailId;

  AttachList copyWith({ num? attachId,
    num? detailId,
  }) =>
      AttachList(attachId: attachId ?? this.attachId,
        detailId: detailId ?? this.detailId,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['attachId'] = attachId;
    map['detailId'] = detailId;
    return map;
  }

}